home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group01b.txt / 000043_icon-group-sender_Fri Mar 2 17:07:52 2001.msg < prev    next >
Internet Message Format  |  2002-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id f2307Q626330
  4.     for icon-group-addresses; Fri, 2 Mar 2001 17:07:26 -0700 (MST)
  5. Message-Id: <200103030007.f2307Q626330@baskerville.CS.Arizona.EDU>
  6. Date: Fri, 02 Mar 2001 15:16:32 -0600
  7. From: gep2@terabites.com
  8. Subject: Re: New Scientist puzzle
  9. To: memoryalpha@juno.com, ardler@argonet.co.uk, icon-group@cs.arizona.edu
  10. Cc: gep2@terabites.com, Steve_Graham@labcorp.com, NLiber@wmsgaming.com,
  11.    cary@cup.hp.com
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14. Content-Length: 1410
  15.  
  16. That one is VERY elegant, Steve.  Nice!!  I really like the use of the csets... 
  17. a good example of Icon expressiveness at work.
  18.  
  19. It would be interesting to see if the people offering New Scientist solutions in 
  20. "those other" programming languages get the hint that S*BOL and Icon might be 
  21. worth looking into.  ;-)  Does anybody know if the magazine is going to publish 
  22. the prettiest solutions?
  23.  
  24. On Fri, 2 Mar 2001, memoryalpha@juno.com wrote:
  25. ># Bob: Here's a (non-PDF'ed) variant of the file I sent you on 28 Feb:
  26. >
  27. >procedure main()    # Written by Steve Hunter 1 March 2000
  28. >
  29. ># All 4 digits distinct? push onto v-list; 
  30. >#  3 of the 4 digits distinct, with first-digit = last-digit? push onto
  31. >n-list:
  32. >v_l := []; n_l := [] 
  33. >every s := string((32 to 99)^2) do 
  34. > push(case *cset(s) of {4: v_l; (s[1]==s[-1], 3): n_l}, s) 
  35. >
  36. >v_t := table(); n_t := table()
  37. >every (*((v:=!v_l) ++ (n:=!n_l)) = 6,  v[-2] == n[2]) do {
  38. >   /v_t[v] := set(); insert(v_t[v], n)
  39. >   /n_t[n] := set(); insert(n_t[n], v)
  40. >} 
  41. >
  42. ># Only print the 1-to-1 pairing(s)
  43. >every 1 = *(n_ms := v_t[v:=key(v_t)]) = *n_t[n:=!n_ms] do write(v, ", ",
  44. >n)
  45. >end 
  46.  
  47. Gordon Peterson                  http://personal.terabites.com/
  48. Support the Anti-SPAM Amendment!  Join at http://www.cauce.org/
  49. 12/19/98: Partisan Republicans scornfully ignore the voters they "represent".
  50. 12/09/00: the date the Republican Party took down democracy in America.
  51.  
  52.